package com.swift.captcha.factory;

import com.swift.captcha.*;
import com.swift.captcha.base.Captcha;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zl
 * @version 1.0
 * @date 2021/12/7 15:46
 */
public class BaseFactory {

    private Map<String,Captcha> maps = new HashMap<>();
    {
        maps.put("SpecCaptcha",new SpecCaptcha());
        maps.put("GifCaptcha",new GifCaptcha());
        maps.put("ChineseCaptcha",new ChineseCaptcha());
        maps.put("ChineseGifCaptcha",new ChineseGifCaptcha());
        maps.put("ArithmeticCaptcha",new ArithmeticCaptcha());
        maps.put("GifCaptcha",new GifCaptcha());
    }

    /**
     *
     * @param key
     * SpecCaptcha 基础图片
     * GifCaptcha 动态基础图片
     * ChineseCaptcha 中文基础图片
     * ChineseGifCaptcha 动态的中文基础图片
     * ArithmeticCaptcha 计算公式
     * GifCaptcha 动态的
     * @return
     */
    public Captcha getCaptcha(String key){
        Captcha captcha = maps.get(key);
        return captcha;
    }
}
